package edu.ncu.dao;

import edu.ncu.entity.Friend;
import edu.ncu.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface FriendDao {
    @Select("select * from friend;")
    List<Friend> findAll();

    @Select("select * from friend where userId = #{userId};")
    List<Friend> findByUserId(int userId);

    @Insert("insert into friend (userId, friendId, friendTime) " +
            "values (#{userId}, #{friendId}, #{friendTime});")
    void saveFriend(Friend friend);

    @Select("select * from friend where userId=#{userId} and friendId=#{friendId}")
    Friend checkIsFriend(int userId,int friendId) ;
}
